

#import <appkit/appkit.h>

#import "WoodBundle.h"
#import "WoodFilter.h"
#import "PFilter.h"

@implementation WoodBundle


- initForDirectory:(const char *)path
{
	[super initForDirectory:path];
  	filterName = NULL;
  	filterDescription = NULL;
  	filter = nil;
  	return self;
}

- free
{
  [filter free];
  return [super free];
}

- (const char *)filterName
{
  	if(!filterName)
		filterName = NXLocalizedStringFromTableInBundle("Filter.strings", self, "Name", "Filter", "Name of Filter");
  	return filterName;
}

- (const char *)filterDescription
{
  	if(!filterDescription)
    	filterDescription = NXLocalizedStringFromTableInBundle("Filter.strings", 
					self, "Description", "Generic Filter.","Description of Filter");
  	return filterDescription;
}

- (WoodFilter *)filter
{
	Class filterClass;

  	if(!filter){
    	filterClass = [self principalClass];
    	filter = [[filterClass allocFromZone:[self zone]] init];
       	if(![filter conformsTo:@protocol(PFilter)])
      		filter = [filter free];
  	}
  	return filter;
}

@end
